import api from '../../request'
import type { 
  EmployeeQueryDTO, 
  AddEmployeeDTO, 
  UpdateEmployeeDTO,
  EmployeeVO,
  UserVO 
} from './types'

/**
 * 物业公司员工管理API
 */
export const propertyEmployeeApi = {
  /**
   * 获取物业公司员工列表
   */
  getPropertyCompanyEmployees(propertyCompanyId: number, queryDTO: EmployeeQueryDTO) {
    return api.get(`/property/employee/${propertyCompanyId}/list`, { params: queryDTO })
  },

  /**
   * 添加员工到物业公司
   */
  addEmployeeToPropertyCompany(propertyCompanyId: number, addEmployeeDTO: AddEmployeeDTO) {
    return api.post(`/property/employee/${propertyCompanyId}/add`, addEmployeeDTO)
  },

  /**
   * 更新员工信息
   */
  updateEmployeeInfo(propertyCompanyId: number, employeeId: number, updateEmployeeDTO: UpdateEmployeeDTO) {
    return api.put(`/property/employee/${propertyCompanyId}/${employeeId}/update`, updateEmployeeDTO)
  },

  /**
   * 移除员工
   */
  removeEmployeeFromPropertyCompany(propertyCompanyId: number, employeeId: number) {
    return api.delete(`/property/employee/${propertyCompanyId}/${employeeId}/remove`)
  },

  /**
   * 搜索可分配的用户
   */
  searchAvailableUsers(keyword: string, excludePropertyCompanyId: number) {
    return api.get('/property/employee/search-users', {
      params: {
        keyword,
        excludePropertyCompanyId
      }
    })
  },

  /**
   * 批量添加员工
   */
  batchAddEmployees(propertyCompanyId: number, addEmployeeDTOList: AddEmployeeDTO[]) {
    return api.post(`/property/employee/${propertyCompanyId}/batch-add`, addEmployeeDTOList)
  },

  /**
   * 获取员工详情
   */
  getEmployeeDetail(propertyCompanyId: number, employeeId: number) {
    return api.get(`/property/employee/${propertyCompanyId}/${employeeId}/detail`)
  }
} 